package com.dengcj.ecology.request.commonaction;

import com.dengcj.ecology.request.NodeActionUtil;
import weaver.general.Util;
import weaver.interfaces.workflow.action.Action;
import weaver.soa.workflow.request.RequestInfo;

/**
 * @author dengchunjie
 * @Description: 自动提交流程
 * @date 2022/3/16 19:33
 */
public class AutoSubmit implements Action {
    // 节点操作者
    private String autoSubmitOperator;

    public String getAutoSubmitOperator() {
        return autoSubmitOperator;
    }

    public void setAutoSubmitOperator(String autoSubmitOperator) {
        this.autoSubmitOperator = autoSubmitOperator;
    }

    @Override
    public String execute(RequestInfo requestInfo) {

        int requestOperator = NodeActionUtil.getMainFormData(requestInfo).getInt(autoSubmitOperator);

        int requestId = Util.getIntValue(requestInfo.getRequestid());


        AutoSubmitThread autoSubmitThread = new AutoSubmitThread(requestId, requestOperator);

        autoSubmitThread.start();

        return Action.SUCCESS;
    }
}
